package com.mindbook.vip.gawxchatinfo.controller.nostrum;

import com.mindbook.vip.gawxchatinfo.entity.nostrum.PhcClinicalExaminationGuidanceResultInspectionItems;
import com.mindbook.vip.gawxchatinfo.entity.nostrum.PrimaryHepaticCarcinomaClinicalExaminationGuidance;
import com.mindbook.vip.gawxchatinfo.entity.user.UserFront;
import com.mindbook.vip.gawxchatinfo.exception.crud.CurdException;
import com.mindbook.vip.gawxchatinfo.service.nostrum.PhcClinicalExaminationGuidanceResultInspectionItemsService;
import com.mindbook.vip.gawxchatinfo.service.nostrum.PrimaryHepaticCarcinomaClinicalExaminationGuidanceService;
import com.mindbook.vip.gawxchatinfo.utils.result.Result;
import com.mindbook.vip.gawxchatinfo.utils.result.ResultEnum;
import com.mindbook.vip.gawxchatinfo.utils.result.ResultUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



/**
 * 肝癌检查指导
 */
@Api(tags = "肝癌临床检查指导")
@RestController
@RequestMapping("primaryHepaticCarinomaClinicalExaminationGuidance")
public class PrimaryHepaticCarcinomaClinicalExaminationGuidanceController {

    @Autowired
    private PrimaryHepaticCarcinomaClinicalExaminationGuidanceService service;

    @PostMapping("/")
    @ApiOperation(value = "业务处理")
    public Result businessProcess(PrimaryHepaticCarcinomaClinicalExaminationGuidance p,BindingResult bindingResult) {

        String groupName = service.businessProcess(p);

        //获取当前的用户id
        UserFront principal = (UserFront) SecurityUtils.getSubject().getPrincipal();

        //将数据保存在数据库中
        p.setUserId(principal.getId());
        p.setGroupName(groupName);
        service.addSelective(p);

        //重新整理下数据库的phc 的表。与实体类对应关系
        return ResultUtils.genSuccessResult(groupName);
    }

}
